//
//  HelloC1.cpp
//  TestC1
//
//  Created by Vincent Tang on 14-3-12.
//  Copyright (c) 2014年 Vincent Tang. All rights reserved.
//

#include "HelloC1.h"
#include <iostream>
#include "TestC2.h"
using namespace std;


class B{
public:
    static B b;
    B *c;
    static const int num =3;
    
    
    
    B(int a = 2 ,bool b = true)
    {
        cout<< a << b << endl;
    }
    void testV(int a =3 ,int b = 5) const;
    
    ~B()
    {
        cout<< "析构函数"<< endl;
    }
    
};

void B::testV(int a,int b) const
{
    cout << a+b << endl;
}

void doSomething(B obj)
{
    cout<< "someThing"<< endl;
}

class Widget
{
    
public:
    string testStr;
    Widget(int a = 3,int b = 3)
    {
    }
    
    Widget(const Widget &wid)
    {
        
    }
    Widget& operator= (const Widget &wid)
    {
        if (this == &wid)
        {
            return *this;
        }
        cout << "operator ="<<std::endl;
        return *this;
    }
    const Widget& display(std::string str) const
    {
        cout<< str << endl;
        return *this;
    }
    ~Widget()
    {
        cout << "~Widget" << endl;
    }
    
    virtual void testB()
    {
        cout << "testBB"<< endl;
    }
};

class TestC:public Widget
{
public:
    void testB()
    {
        cout << "testCc"<< endl;
    }
};

template <class T>
void Temp1(T &T1 ,T &t2);

int main()
{
    B b;
    b.testV(2,2);
    cout << cc <<endl;
    cout<< b.num <<endl;
    extern int xx;
    cout << xx << endl;
    cout << c2 << endl;
    
    string test = "xx";
    string test1 = "oo";
    const string *ss = &test;
    string* const ss1 = &test;
    string const *ss2 = &test;
    cout << "s2" << ss<<endl;
    cout << *ss << endl;
    ss++;
    cout << ss <<endl;
    cout << *ss << endl;
    ss2++;
    cout << *ss1 << endl;
    *ss1 = test1;
    cout << *ss1<<endl;
    
    Widget w1(3,2) ;
    Widget w2(w1);
    w1 = w2;
    Widget *dget;
    TestC c1;
    dget = &c1;
    dget-> Widget::testB();
    Widget w3 = w2;
    w3.testB();
    w3.display("ssssd");
    Widget *w4 = new Widget();
    
    w4->testB();
    cout << "before delete" << endl;
    cout << w4 << endl;
    cout << &w1 << endl;
    cout << &w2 << endl;
    cout << &w3 << endl;
    delete w4;
    cout << "after delete" << endl;
    cout << "Hello Mac" << endl;
    exit(1);
    return 1;
}